package com.visitcqut.service.impl;

import com.visitcqut.domain.Tourist;
import com.visitcqut.mapper.TouristMapper;
import com.visitcqut.service.TouristService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * @program: visitcqut
 * @description: 游客服务实现类
 * @author: ATAO
 * @create: 2020-11-14 13:37
 **/

@Repository
public class TouristServiceImpl implements TouristService {


    /**
     * 数据库访问层
     */
    @Autowired
    TouristMapper touristMapper;


    /**
     * 添加游客
     * @param data
     * @return int
     */
    @Override
    public int insert(Tourist data) {
        return touristMapper.insert(data);
    }


    /**
     * 删除游客
     * @param id
     * @return int
     */
    @Override
    public int delete(Integer id) {
        return touristMapper.delete(id);
    }


    /**
     * 更新游客信息
     * @param data
     * @return int
     */
    @Override
    public int update(Tourist data) {
        return touristMapper.update(data);
    }


    /**
     * 根据id查找游客
     * @param id
     * @return int
     */
    @Override
    public Tourist findById(Integer id) {
        return touristMapper.findById(id);
    }


    /**
     * 根据查找所有学生
     * @return Tourist
     */
    @Override
    public List<Tourist> findAll() {
        return touristMapper.findAll();
    }
}

